package com.mark.dao;

import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

import com.mark.entity.StuAnswer;
@Repository
public interface StuAnswerRepository extends PagingAndSortingRepository<StuAnswer, Long>, JpaSpecificationExecutor<StuAnswer> {
	@Query(value="from StuAnswer s where s.student.id=?1 and s.exam.id=?2")
	public StuAnswer findByStuAndExam(Long stuId,Long eId);
	@Query(value="select count(*) from StuAnswer s where s.completed=true and s.marked=false and s.exam.id=?1")
	public Integer getTaskCountByExamId(Long examId);
	@Query(value="from StuAnswer s where s.exam.id=?1 and s.marked=false and s.completed=true")
	public List<StuAnswer> findUnMarkedList(Long exam_id);
}
